﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace EYangFramework.Domain.Entitys.ValueObjects
{
    public abstract class ValueObject : IEntity
    {
        public virtual Guid ID { get; set; }
        public virtual DateTime CREATETIME { get; set; }
        public virtual string CREATEUSER { get; set; }
        public ValueObject()
        {
            ID = Guid.NewGuid();
            CREATETIME = DateTime.Now;
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return false;
            }
            if (obj.GetType() != this.GetType())
            {
                return false;
            }
            return this.ID == (obj as IEntity).ID;
        }
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        private bool IsSimpleType(object obj)
        {
            var type = obj.GetType().ToString();
            return (type == "System.Int32" || type == "System.Double" || type == "System.Decimal" || type == "System.Single" ||
                type == "System.String" || type == "System.Boolean" || type == "System.Byte" || type == "System.Char");
        }
    }
}
